package com.xs.mvc.common;

import java.util.List;
import java.util.Map;

import org.springframework.beans.BeanUtils;

/**
 * @Title: <P>JsonUtil.java</P>
 * @Package <P>com.xs.mvc.common</P>
 * @Description: <P>TODO该类...</P>
 * @author renweiping
 * @date 2019年2月1日 下午2:59:28
 * @version 1.0
 */

public class JsonUtil {
	public static List<?> convertToListEntity(List<Map<String,Object>> sourceList,Class<?> cls){
		if(sourceList!=null && !sourceList.isEmpty()){
			
		}
		return sourceList;
	}
	
	
	public static Object convertToEntity(Map<String,Object> source,Class<?> cls){
		Object targect = null;
		try {
			targect = cls.newInstance();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		BeanUtils.copyProperties(source, targect);
		return targect;
	}
	
}
